home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / aminet / util / gnu / gnu_oleo_1_2_2.lha / oleo-1.2.2 / ir.h < prev    next >
C/C++ Source or Header  |  1993-03-03  |  3KB  |  95 lines

  1. /*    Copyright (C) 1992, 1993 Free Software Foundation, Inc.
  2.  
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 2, or (at your option)
  6. any later version.
  7.  
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  11. GNU General Public License for more details.
  12.  
  13. You should have received a copy of the GNU General Public License
  14. along with this software; see the file COPYING.  If not, write to
  15. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  16.  
  17.  
  18. #ifndef INTRECTANGLEH
  19. #define INTRECTANGLEH
  20.  
  21. #include "proto.h"
  22. /*  t. lord    Thu Feb 13 00:44:35 1992    */
  23.  
  24. #define xx_IRllx(R)  ((R)->x)
  25. #define xx_IRlly(R)  ((R)->y)
  26. #define xx_IRurx(R)  ((R)->x + (R)->w - 1)
  27. #define xx_IRury(R)  ((R)->y + (R)->h - 1)
  28.  
  29. typedef struct xx_sIntRectangle * xx_IntRectangle;
  30. struct xx_sIntRectangle
  31. {
  32.   int x, y;
  33.   unsigned int w, h;
  34. };
  35.  
  36. #define xx_IRinit(R,X,Y,W,H)   (void)(((R)->x = (X)), ((R)->y = (Y)), \
  37.                       ((R)->w = (W)), ((R)->h = (H)))
  38. /* extern int xx_IRintersects (xx_IntRectangle, xx_IntRectangle); */
  39. #define xx_IRintersects(R1,R2) \
  40.   (xx_IRllx(R1) <= xx_IRurx(R2) &&\
  41.    xx_IRurx(R1) >= xx_IRllx(R2) &&\
  42.    xx_IRlly(R1) <= xx_IRury(R2) &&\
  43.    xx_IRury(R1) >= xx_IRlly(R2))
  44.  
  45.  
  46.  
  47. #ifdef __STDC__
  48. extern int xx_IRencloses (xx_IntRectangle, xx_IntRectangle);
  49. extern int xx_IRequiv (xx_IntRectangle, xx_IntRectangle);
  50. extern void xx_IRbound (xx_IntRectangle, xx_IntRectangle);
  51. extern int xx_IRarea (xx_IntRectangle);
  52. extern int xx_IRhits_point (xx_IntRectangle, int, int);
  53. extern void xx_IRclip (xx_IntRectangle,  xx_IntRectangle);
  54. extern int xx_IRsubtract (xx_IntRectangle outv,
  55.                 xx_IntRectangle, xx_IntRectangle);
  56. #ifdef PRETTY_PRINT_DECLS
  57. extern void xx_pp_intrectangle (xx_IntRectangle, FILE *);
  58. #endif
  59. #else
  60. extern int xx_IRencloses ();
  61. extern int xx_IRequiv ();
  62. extern void xx_IRbound ();
  63. extern int xx_IRarea ();
  64. extern int xx_IRhits_point ();
  65. extern void xx_IRclip ();
  66. extern int xx_IRsubtract ();
  67. #ifdef PRETTY_PRINT_DECLS
  68. extern void xx_pp_intrectangle ();
  69. #endif
  70. #endif
  71.  
  72. #define xx_IRx(R) ((R)->x)
  73. #define xx_IRy(R) ((R)->y)
  74. #define xx_IRw(R) ((R)->w)
  75. #define xx_IRh(R) ((R)->h)
  76. #define xx_IRxl(R) xx_IRx(R)
  77. #define xx_IRyl(R) xx_IRy(R)
  78. #define xx_IRxh(R) (xx_IRx(R) + xx_IRw(R) - 1)
  79. #define xx_IRyh(R) (xx_IRy(R) + xx_IRh(R) - 1)
  80.  
  81. #endif
  82.  
  83. #ifdef PRETTY_PRINT
  84.  
  85. void
  86. xx_pp_intrectangle (r, stream)
  87.      xx_IntRectangle r;
  88.      FILE * stream;
  89. {
  90.   fprintf (stream, "(xx_IntRectangle x %d, y %d, w %d, h %d)",
  91.        r->x, r->y, r->w, r->h);
  92. }
  93.  
  94. #endif
  95.